package com.lanhai.enums;

public enum LoadState {
	KK(0, "0", "上空下空"),
	KM(1, "1", "上空下满"),
	MK(2, "10", "上满下空"),
	MM(3, "11", "上满下满"),
	MN(4, "12", "上满非满"),
	KN(5, "2", "上空非满"),
	NK(6, "20", "下空非满"),
	NM(7, "21", "非满下满"),
	NN(8, "22", "上下非满");
	
	private LoadState(Integer code, String hex, String name){
		this.code = code;
		this.name = name;
		this.hex = hex;
	}
	private Integer code;
	private String name;
	private String hex;
	public Integer getCode() {
		return code;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
    public String getHex() {
		return hex;
	}
	public void setHex(String hex) {
		this.hex = hex;
	}
	
	public static String getValueByCode(Integer code){
        for(LoadState tf:LoadState.values()){
        	if(code == tf.getCode()){
                return tf.getName();
            }
        }
        return  null;
    }

	public static String getHexByCode(Integer code){
        for(LoadState tf:LoadState.values()){
            if(code == tf.getCode()){
                return tf.getHex();
            }
        }
        return  null;
    }

	public static LoadState getLoadStateByHex(String hex){
        for(LoadState tf:LoadState.values()){
            if(hex.equals(tf.getHex())){
                return tf;
            }
        }
        return  null;
    }
	
}
